﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using ServicesComponent.Repositories.Core;
using Business_Objects;
using Data_Objects;
namespace ServicesComponent.Repositories
{
    ///// <summary>
    ///// Student Repository. Good example of CRUD operations.
    ///// </summary>
    public class StudentRepository : IStudentRepository
    {
        private static readonly IStudentDao _student = DataAccess.StudentDao;
        public List<Student> GetList()
        {
            return _student.GetStudent().ToList();
        }

        public Student Get(string id)
        {
            return _student.GetStudentByID(id);
        }

        public void Insert(Student t)
        {
            _student.InsertStudent(t);
        }

        public void Update(Student t)
        {
            _student.UpdateStudent(t);
        }

        public void Delete(Student t)
        {
            _student.DeleteStudent(t);
        }

        public List<Student> GetStudentBySchoolId(int schoolId)
        {
         return   _student.GetStudentBySchoolId(schoolId);
        }


        public List<Student> GetStudentByClassIdAndSchoolID(int schoolId, string classId)
        {
            return _student.GetStudentByClassIdAndSchoolID(schoolId ,classId);
        }


        public List<Student> GetStudentBySchoolIdAndSchoolYear(string SchoolYearID, int schoolId)
        {
            return _student.GetStudentBySchoolIdAndSchoolYear(SchoolYearID, schoolId);
        }


        public List<Student> GetStudentBySchoolIdAndSchoolYearNotClass(string SchoolYearID, int schoolId)
        {
            return _student.GetStudentBySchoolIdAndSchoolYearNotClass(SchoolYearID, schoolId);
        }


        public List<Student> GetStudentBySchoolIdAndSchoolYearClass(string SchoolYearID, int schoolId, string classId) 
        {
            return _student.GetStudentBySchoolIdAndSchoolYearClass(SchoolYearID, schoolId, classId);
        }
    }
}